//
//  CarModel.swift
//  Automobile
//
//  Created by erkebulan elzhan on 7/28/20.
//  Copyright © 2020 erkebulan elzhan. All rights reserved.
//

import Foundation


struct CarModel {
    
    var car: Car!
    
    init (car: Car) {
        self.car = car
    }
    
    var carNumber: String {
        if let carNumber = car.carNumber {
            return "\(carNumber.number)"
        } else {
            return ""
        }
    }
    
    var carLetters: String {
        return car.carNumber?.letters ?? ""
    }
    
    var cityId: String {
        return car.carNumber?.cityId ?? ""
    }
    
    var carName: String {
        return car.carName ?? ""
    }
    
    var isNewFormat: Bool {
        return car.carNumber?.cityId.count == 2
    }
    
    var isSelected: Bool = false
}

